package org.fly.jingwei.service.impl;

import org.fly.jingwei.dao.CommonDao;
import org.fly.jingwei.entity.DatabaseConnEntity;
import org.fly.jingwei.service.CommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author leo.jie (weixiao.me@aliyun.com)
 * @version 1.0
 * @organization bigdata
 * @website https://www.jielongping.com
 * @date 2020/5/30 10:57 上午
 * @since 1.0
 */
@Service
public class CommonServiceImpl implements CommonService {
    private final CommonDao commonDao;

    public CommonServiceImpl(CommonDao commonDao) {
        this.commonDao = commonDao;
    }

    @Override
    public List<DatabaseConnEntity> getDatabases() {
        return commonDao.getDatabasesConn();
    }

    @Override
    public void deleteDatabaseConn(Integer id) {
        commonDao.deleteDatabaseAttr(id);
        commonDao.deleteDatabaseMeta(id);
        commonDao.deleteJobDatabase(id);
        commonDao.deleteTransDatabase(id);
    }
}
